﻿using furion.blog.Domain.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace furion.blog.Utils
{
    public class ResultUtil
    {
        /******************************成功返回信息******************************************/
        public static ResultVO Success(string status, string msg, object value, int code)
        {
            return Create(status, msg, value, code);
        }

        public static ResultVO Success(string msg, object value, int code)
        {
            return Create(ResultVO.SUCCESS_STATUS, msg, value, code);
        }

        public static ResultVO Success(object value)
        {
            return Create(ResultVO.SUCCESS_STATUS, "done", value, ResultVO.SUCCESS_CODE);
        }

        public static ResultVO Success()
        {
            return Create(ResultVO.SUCCESS_STATUS, "done", null, ResultVO.SUCCESS_CODE);
        }

        /******************************失败返回信息******************************************/
        public static ResultVO Failure(string status, string msg, object value, int code)
        {
            return Create(status, msg, value, code);
        }

        public static ResultVO Failure(string msg, object value, int code)
        {
            return Create(ResultVO.FAILURE_STATUS, msg, value, code);
        }

        public static ResultVO Failure(string msg)
        {
            return Create(ResultVO.FAILURE_STATUS, msg, null, ResultVO.FAILURE_CODE);
        }

        public static ResultVO Failure(object value)
        {
            return Create(ResultVO.FAILURE_STATUS, "failure", value, ResultVO.FAILURE_CODE);
        }


        private static ResultVO Create(string status, string msg, object value, int code)
        {
            return new ResultVO(status, value, msg, code);
        }

    }
}
